home *** CD-ROM | disk | FTP | other *** search
/ Acorn Risc Technologies StrongARM CD-ROM / Acorn Risc Technologies StrongARM CD-ROM.iso / ftp / documents / appnotes / 046_060 / 058c / Text
Encoding:
Text File  |  1993-08-02  |  20.8 KB  |  576 lines

  1. 20th October 1992
  2. -----------------------------------------------------------------------------
  3. Support Group Application Note 
  4. Number: 058
  5. Issue: 1 
  6. Author:
  7. -----------------------------------------------------------------------------
  8.  
  9. 6502 to ARM Application Note
  10.  
  11. -----------------------------------------------------------------------------
  12. Applicable Hardware: All RISC machines
  13.  
  14. Related Application Notes:      059 - Archimedes 6502 Emulation
  15.                                 061 - 6502 Applications using !65Host
  16.  
  17. -----------------------------------------------------------------------------
  18. Copyright (C) Acorn Computers Limited 1992
  19.  
  20. Every effort has been made to ensure that the information in this leaflet is 
  21. true and correct at the time of printing. However, the products described in
  22. this leaflet are subject to continuous development and improvements and
  23. Acorn Computers Limited reserves the right to change its specifications at
  24. any time. Acorn Computers Limited cannot accept liability for any loss or
  25. damage arising from the use of any information or particulars in this
  26. leaflet. ACORN, ECONET and ARCHIMEDES are trademarks of Acorn Computers
  27. Limited.
  28. -----------------------------------------------------------------------------
  29. Support Group
  30. Acorn Computers Limited
  31. Acorn House
  32. Vision Park
  33. Histon
  34. Cambridge       CB4 4AE
  35. -----------------------------------------------------------------------------
  36.  
  37.  
  38. CONTENTS
  39.  
  40. Foreword
  41. Introduction
  42. Legal issues
  43. ARM BASIC
  44. 6502 Emulation
  45. Evaluation of portability
  46. Transfer
  47. Running Instructions
  48. Available resources
  49.  
  50.  
  51. FOREWORD
  52.  
  53. The term 6502 is used in this document to refer to the following Acorn
  54. products based on the 6502 microprocessor:
  55.  
  56.         BBC Model B
  57.         BBC Model B+
  58.         Acorn Electron
  59.         BBC Master 128
  60.         BBC Master Compact
  61.  
  62. ARM is short for Acorn RISC Machine.  This is the RISC (Reduced Instruction
  63. Set Chip) microprocessor at the heart of the Archimedes architecture.
  64.  
  65. Products of Acorn Computers Ltd are subject to continuous development and
  66. improvment, and so the information contained in this document is subject to
  67. change without notice.
  68.  
  69. Moreover, while every effort has been made for accuracy at the time of
  70. writing, it s acknowleged that there may be errors or omissions in this
  71. note.
  72.  
  73. It is inevitable that much of the content of this document is of a technical
  74. nature.
  75.  
  76.  
  77. INTRODUCTION
  78.  
  79. This document looks at the issues involved in porting software for Acorn's
  80. 6502-based microcomputers onto the Archimedes range of microcomputers.  It
  81. is written to help you identify which items of software may run on the
  82. Archimedes microcomputer, and how to transfer them and get them running.  It
  83. also covers resources available to help in porting software.  It is
  84. primarily targetted at the broad base of 6502-based educational software
  85. used in schools and colleges.
  86.  
  87. Before you attempt to port existing software on to the Archimedes
  88. microcomputerm you need to consider the following questions:
  89.  
  90.         Is it legal?
  91.         Is it likely to run?
  92.         How can the software be transferred?
  93.         What running instructions are needed?
  94.  
  95. IS IT LEGAL?
  96.  
  97. You can ignore this question if it is a program that you have written
  98. yourself, but commercial software is sold subject to terms and conditions
  99. which you must comply with.  This is covered in the chapter entitled LEGAL
  100. ISSUES.
  101.  
  102.  
  103. IS IT LIKELY TO RUN?
  104.  
  105. Whether a particular piece of software for a 6502-based machine will run on
  106. the Archimedes microcomputer will depend on how the program has been
  107. written.
  108.  
  109. If you are dealing with a number of programs, then it would be worth
  110. considering the likelihood of success before spending time transferring and
  111. attempting to run the software.  Further details are given in the chapter
  112. entitled EVALUATION OF PORTABILITY.
  113.  
  114.  
  115. WILL IT RUN NATIVE, OR UNDER 6502 EMULATION?
  116.  
  117. Native:  The version of BBC BASIC (BASIC 5) developed for the ARM may be
  118. referred to in this document and elsewhere as being native to the Archimedes
  119. microcomputer.
  120.  
  121. You can attempt to run programs written in BASIC for the 6502-based
  122. microcomputers, using ARM BASIC on the Archimedes microcomputer, provided
  123. that the programs are written entirely in BASIC and contain no Assembler. 
  124. Further details are given in the chapter entitled ARM BASIC.
  125.  
  126. 6502 Emulation:  In addition to program written entirely in BASIC, you can
  127. attempt to run 6502 machine code programs and BASIC programs that assemble
  128. or call 6502 machine code routines using the 6502 emulator.  Further details
  129. are given in the chapter entitled 6502 EMULATION.
  130.  
  131.  
  132. HOW CAN THE SOFTWARE BE TRANSFERRED?
  133.  
  134. Before you can attempt to run 6502-based software on the Archimedes
  135. microcomputer, you need to find a means of transfer from its current medium
  136. (eg 5.25 inch disc in DFS format) to a medium accessible to the Archimedes
  137. computer (eg 3.5 inch disc in ADFS format).  This is covered in the chapter
  138. entitled TRANSFER.
  139.  
  140.  
  141. WHAT RUNNING INSTRUCTIONS ARE NEEDED?
  142.  
  143. You may need to use modified running instructions in order to get the
  144. software started on the Archimedes computer.  Guidance and suggestions for
  145. this are provided in the chapter RUNNING INSTRUCTIONS.
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154. LEGAL ISSUES
  155.  
  156. COPYRIGHT
  157.  
  158. Unless you are dealing with software already on 3.5 inch ADFS format disc,
  159. attempting to port software to the Archimedes microcomputer will necessarily
  160. entail copying the software.
  161.  
  162. For the purpose of copyright in this country, software is regarded as a work
  163. of art.  Making an unauthorised copy of an item of software for which you do
  164. not hold the copyright is against the law.  It is your responsibility to
  165. ensure that you comply with the law, and you will need to consider which of
  166. the following applies with a particular item of software:
  167.  
  168. Your own programs:  If you have written the program, you automatically hold
  169. the copyright unless you assign the right to another party.  You are free to
  170. copy the program.
  171.  
  172. Commercial software:  It is essential that you consult the terms and
  173. conditions of sale of a particular item of commercially available software. 
  174. The terms may make provision for making a number of copies (eg under a
  175. license scheme within an institution), a single back-up copy, or no copies
  176. at all.
  177.  
  178. Aside from copying, the conditions of sale may specify hardware or mode of
  179. use.  For example, that you cannot use a disc version on a network.
  180.  
  181. In general, the conditions will not bar you from running the software on a
  182. machine other than that for which it was intended (eg running a package for
  183. the BBC Model B on the Archimedes), but consult the section on Support.
  184.  
  185. Public Domain:  Some software is distributed free of charge, or with a
  186. nominal charge to cover costs.  However, although you will be free to make a
  187. copy, there may be futher conditions that you will need to comply with
  188. (registering yourself as a use, for example). Some software is available on
  189. a similar basis, but within the confines of the LEA where it was developed.
  190.  
  191.  
  192. SUPPORT
  193.  
  194. In general, there are conditions specifying the guarantee and support that
  195. go with the purchase of an item of commercially available software.  It is
  196. very likely that use of the software on a system other than that specified
  197. will void the guarantee and the vendor's obligation to provide support. 
  198. Thus if you port a title for the BBC Model B onto the Archimedes computer,
  199. and find that it does not work, you should not expect any help from the
  200. supplier of the software title.
  201.  
  202.  
  203. ARM BASIC
  204.  
  205. Any program written in BASIC for the 6502-based microcomputers will probably
  206. run without modification on on the Archimedes microcomputer, provided that
  207. it does not exhibit any of the following:
  208.  
  209.         - 6502 assembler, or accessing 6502 machine code.
  210.         - assuming the value of PAGE or HIMEM
  211.         - using the indirection operators ($, ! and ?) to access locations
  212.           in the OS workspace
  213.         - accessing undocumented OS routines with CALL or USR ( )
  214.         - using * commands that require a particular extension (eg *DISC for
  215.           the DFS).
  216.  
  217. In addition to these general points, loading or saving screen files to and
  218. from screen memory and likewise for user-defined graphics characters to and
  219. from Page C will not work.
  220.  
  221. The way sound is handled is completely different on the Archimedes, so that
  222. programs which use sound may produce strange and unexpected effects.  The
  223. SOUND and ENVELOPE statements are ignored by ARM BASIC.
  224.  
  225. More information can be obtained in the application note entitled Archimedes
  226. 6502 Emulation.  This note considers features of 6502 software which would
  227. give problems when run native on the Archimedes microcomputer, and indicates
  228. if 6502 emulation could provide the solution.
  229.  
  230.  
  231. 6502 EMULATION
  232.  
  233. There are two 6502 emulators for the Archimedes computer, called 65Arthur
  234. and BBCrun.
  235.  
  236. [ updated stuff needed here]
  237.  
  238.  
  239.  
  240.  
  241. RUNNING AN APPLICATION
  242.  
  243. In order to run an application under emulation, you need to invoke the
  244. emulator first and then attempt to run the application package.  Often, this
  245. will amount to running the application;s !BOOT file.  Alternatively, you can
  246. incorporate invoking the emulator in the applications !BOOT file.
  247.  
  248. Please note that the instructions for running the application will probably
  249. need modification, and this may involve editing the !BOOT file.  More
  250. information is given in the section entitled RUNNING INSTRUCTIONS.
  251.  
  252.  
  253. EVALUATION OF PORTABILITY
  254.  
  255. INTRODUCTION
  256.  
  257. The Archimedes microcomputer has a high degree of commonality with the
  258. 6502-based machines, so that there is the comfort of familiarity for
  259. end-users and programmers alike.  However, it is important to remember that
  260. the hardware is completely different and this must temper your expectations
  261. as regards portability.
  262.  
  263. Whether a program written for a 6502-based machine will run on the
  264. Archimedes depends on how the program has been written and what it is doing
  265. at the code level.  For this reason, all that can be provided here is a
  266. number of generalised statements; we are dealing with 'may' rather than
  267. 'can' and for a particular title it is a question of try it and see.
  268.  
  269.  
  270.  
  271.  
  272. RESOURCES
  273.  
  274. (see also the section entitled AVAILABLE RESOURCES)
  275.  
  276. BBCscan:  You can use the program BBCscan to help identify potential
  277. problems in a BASIC program.  This has been written to run across the range
  278. of Acorn  machines, so that you can assess portability before attempting
  279. transfer.
  280.  
  281. Application Note:  The application note Archimedes 6502 Emulation classifies
  282. features of 6502 programs at the code level that are likely to cause
  283. problems on the Archimedes microcomputer.
  284.  
  285. GENERAL POINTS
  286.  
  287. Software that is 'well behaved' and not tied to a particular filing system
  288. has a good chance of running on the Archimedes computer.  'Well behaved'
  289. means not making assumptions about the hardware and firmware environment,
  290. and using the legal interfaces into the operating system.  Thus programs,
  291. that have been written to run on a range of 6502 microcomputers are more
  292. likely to port onto the Archimedes microcomputer than generic versions.
  293.  
  294. As regards filing systems, software developed for the DFS disc filing system
  295. may not port onto the Archimedes, which uses the ADFS (Advanced Disc Filing
  296. System).  Network versions, on the other hand, are more likely to port. 
  297. Electron Plus 3 or Master Compact software on disc uses the ADFS, and so is
  298. less likely to run into problems owing to the filing system.
  299.  
  300. 65Tube:  65Tube is a second processor emulator, and so programs which are
  301. Tube compatible will probably run with 65Tube invoked.
  302.  
  303. Arcade style games will not run under emulation since they poke the screen
  304. for fast animation, but well-written languages will.  For example, the
  305. Compact View series. 
  306.  
  307. Correctly written ROM images will run, providing that they are not protected
  308. in any way, or assume that they are located in ROM or sideways RAM.
  309.  
  310.  
  311. TRANSFER
  312.  
  313. Before you attempt transfer, you must ensure that you are not in breach of
  314. copyright (consult the chapter entitled LEGAL ISSUES).
  315.  
  316. A summary of the possible starting points and methods of transfer is given
  317. at the end of this section, which is designed to help you quickly identify
  318. the method appropriate to your needs.
  319.  
  320. How best to transfer your existing 6502 software, so that it can be tried on
  321. the Archimedes microcomputer, will depend on the following factors:
  322.  
  323.         - the medium the software is on (eg 5.25 inch disc)
  324.         - what 6502 machine(s) you have (eg Master 128)
  325.         - the quantity of software involved
  326.  
  327.  
  328.  
  329. The following possibilities, classified according to your starting point,
  330. are considered:
  331.  
  332.         - 3.5 inch disc
  333.         - network
  334.         - 5.25 inch disc
  335.         - cassette
  336.         - ROM
  337.         - other media - eg bar codes
  338.  
  339. The following hardware routes are considered:
  340.  
  341.         - keyboard
  342.         - network
  343.         - RS423 cable
  344.         - 5.25 inch external drive
  345.  
  346. The information is summarised at the end of this section in the form of a
  347. table.
  348.  
  349. STARTING POINT
  350.  
  351. 3.5 inch disc:  Archimedes ADFS support three formats for floppy discs:
  352.         
  353.         E       800k
  354.         D       800k
  355.         L       640k
  356.  
  357. The L format is the same as that for the Master Compact and Electron Plus 3
  358. (or for a Master 128 with a 3.5 inch external drive attachment), and so
  359. discs in this format can be read by the Archimedes unless they have been
  360. copy-protected.  
  361.  
  362. In general, no transfer is necessary.
  363.  
  364. Network:  An Archimedes can be stationed on an Econet network, for which you
  365. need to install an Econet module (the same unit as for the Master 128),
  366. connect the Archimedes with an Econet lead, and set its station number. 
  367. This gives you access to the software on the network medium (hard or floppy
  368. disc).
  369.  
  370. No transfer is necessary.
  371.  
  372. 5.25 inch disc:  You will need to consider one of the possible means of
  373. transfer in the next section.  Do not attempt to transfer software that is
  374. copy-protected.
  375.  
  376. Cassette:  Since there is no Tape Filing System or cassette port on the
  377. Archimedes microcomputer, there is no direct means of transferring software
  378. from cassette.
  379.  
  380. If you have an Electron Plus 3, use it to copy from cassette to 3.5 inch
  381. disc, which can be read by the Archimedes ADFS.  Otherwise, you will need to
  382. find another route (eg, load the program from cassette into memory, and then
  383. transfer via the RS423 ports).
  384.  
  385. Other media:  For software on other media, such as Bar codes, you will need
  386. to transfer onto another medium first.
  387.  
  388. MEANS OF TRANSFER
  389.  
  390. Keyboard:  For a few short BASIC programs, typing them in may be the
  391. quickest method of transfer.
  392.  
  393. Network:  Since you can network a BBC Model B or Master series, by using a
  394. local disc drive with it you can copy software onto the network medium, and
  395. from there to the Archimedes.  This provides a ready means of transferring
  396. 5.25 inch DFS based software to the Archimedes, providing that the discs are
  397. not copy-protected.
  398.  
  399. RS423 cable:
  400.         BBC B, B+ or Master 128 RS423   >>  RS423       Archimedes
  401.  
  402.         5.25 inch drive                 3.5 inch drive
  403.  
  404. The RS423 port on the Archimedes microcomputer is designed for connecting a
  405. modem.  As such, any device connected to the port must appear to the
  406. computer as a modem in order that the handshaking runs correctly.
  407.  
  408. The pinout of the port runs as follows:
  409.  
  410.         Pin 1   DCD     Data Carry Detect
  411.         Pin 2   RXD     Receive Data
  412.         Pin 3   TXD     Transmit Data
  413.         Pin 4   DTR     Data Terminal Ready
  414.         Pin 5   GND     Zero Volts
  415.         Pin 6   DSR     Data Set Ready
  416.         Pin 7   RTS     Ready To Send
  417.         Pin 8   CTS     Clear To Send
  418.         Pin 9   RI      Phone Line Ringing
  419.  
  420. The pins are laid out as below, when viewed from the back:
  421.  
  422. 1               2               3               4       5
  423.         6               7               8                   9
  424.  
  425. If you want to connect a non-modem device, for example connecting an
  426. Archimedes microcomputer back to back with a BBC Model B, athe normal
  427. arrangement of connecting RTS on one machine to CTS on the other, and RXD on
  428. one to TXD on the other, should be used.  Further to this however, DCD, DTR
  429. and DSR need all to be tied together in order to simulate a modem.
  430.  
  431. At high baud rates, problems will arise if the Archimedes own receive and
  432. transmit rates are set differently.  This is due to the RS423 controller
  433. chip only having one baud rate generator so when different rates are
  434. required problems arise.  If either transmission or reception at a high rate
  435. ( > 4,800 baud) is required, it is important to set both transmit and
  436. receive rates the same even if only one direction is being used.
  437.  
  438. Further information is available in application notes; consult the section
  439. entitled AVAILABLE RESOURCES.
  440.  
  441. At  the time of writing, at least one third party had developed a
  442. commercially available RS423 transfer kit for the Archimedes microcomputer.
  443.  
  444. External 5.25 inch drive:  You are advised not to attempt to attach a 5.25
  445. inch drive cable to the current drive unit cable in the Archimedes machine. 
  446. This may damage a chip, which introduces an undetectable error. 
  447. Additionally, there can be an excessive load on the Archimedes driver gates
  448. from some drives.
  449.  
  450. At the time of writing at least one independent company was completing work
  451. on an external 5.25 inch drive unit, and you should be able to obtain
  452. further information from your dealer.
  453.  
  454. TRANSFER SUMMARY
  455.  
  456. (Draw file 'Table1')
  457.  
  458.  
  459.  
  460. RUNNING INSTRUCTIONS
  461.  
  462. The following section is written with a typical eventuality in mind; namely
  463. that you have transferred software onto 3.5 inch disc, probably from 5.25
  464. inch disc.
  465.  
  466. The software start from an EXEC !BOOT file, and you may need to note the
  467. contents of this file an edit it as appropriate for starting the application
  468. on the Archimedes microcomputer.
  469.  
  470.  
  471. GETTING STARTED
  472.  
  473. BBC Model B etc:  The 6502 based microcomputers boot up into BASIC command
  474. mode.
  475.  
  476.  
  477. It is possible to get software on discs to autoboot, ie so that the user can
  478. place the disc in the drive and press SHIFT + BREAK to start the program. 
  479. Most commercially available disc based software is distrubuted like this.
  480.  
  481. To do this, the start-up option on the disc needs to be set, and a file name
  482. !BOOT provided on the disc.  then, in response to SHIFT + BREAK, the
  483. computer looks for a !BOOT file and runs it.  The !BOOT file will contain a
  484. few key instructions needed to get the program running.
  485.  
  486. If !BOOT is a machine code program, the start up option needs setting to 2. 
  487. However, you are more likely to encounter !BOOT and an EXEC file, for which
  488. the start-up option needs setting to 3.
  489.  
  490. If !BOOT is an EXEC file, you can list the instructions it contains by
  491. typing *TYPE !BOOT, followed by pressing RETURN.
  492.  
  493. The Archimedes microcomputer:  By default the Archimedes microcomputer boots
  494. up into the desktop program.  There are three routes available to you to get
  495. started.  the first circumnavigates the desktop altogether.
  496.  
  497. To get a disc to auto-boot on Archimedes, you need to set the disc option to
  498. 2, and you need to provide a !BOOT file which is either ARM machine code or
  499. BASIC.
  500.  
  501. For example, consider a BASIC program called FRIDA which you have
  502. transferred onto a 3.5 inch disc:
  503.  
  504.         - place the disc in the disc drive
  505.         - exit from the desktop
  506.         - set the start-up option on the disc to 2:  type *OPT 4,2, then
  507.           press Return
  508.         - provide a BASIC program as the !BOOT file:  type 10 CHAIN "FRIDA",
  509.           then press Return
  510.         - type SAVE "!BOOT", then press Return.
  511.  
  512. Now when you press SHIFT + BREAK, the !BOOT file will be run, which in turn
  513. runs your program FRIDA.
  514.  
  515. The other two routes require you to work from the desktop, and the existence
  516. of a !BOOT file is assumed:
  517.  
  518.         - exit from the desktop
  519.         - run the !BOOT file by typing in the appropriate commands:
  520.                 eg, type CH. "!BOOT" followed by Return in the example above.
  521.  
  522. OR
  523.  
  524.         - select the disc icon on the icon bar
  525.         - select the !BOOT option from the menu of icons available
  526.  
  527.  
  528. KEYBOARD
  529.  
  530. Some changes in the running instructions referring to the keyboard may be
  531. required.  In particular, the red functon key f0 on the Model B keyboard is
  532. replace by the PRINT key on the Archimedes keyboard. 
  533.  
  534.  
  535.  
  536. AVAILABLE RESOURCES
  537.  
  538. APPLICATION NOTES
  539.  
  540. Archimedes 6502 Emulation and the RS423 Application Note are available by
  541. writing to:
  542.  
  543.         Customer Services
  544.         Fulbourn Road
  545.         Cherry Hinton
  546.         Cambridge
  547.         CB1 4JN
  548.  
  549.  
  550. 65HOST and 65TUBE are provided on the Archimedes Applications Discs.
  551.  
  552. BBC Model B Emulator Utilities:
  553.  
  554. Copies of these utilities can be obtained by writing to Acorn Customer
  555. Services at the above address.  The programs are:
  556.  
  557. BBCscan Searches tokenised BBC BASIC programs and flags lines that may cause
  558.         problems when  porting to ARM computers.  Runs on the BBC Model B,
  559.         B+, Master series, Acorn Electron and Archimedes computers.
  560.  
  561. PicConv Converts BBC screen image files and GXR sprites into Archimedes
  562.         sprites.  MODE 7 files are converted for display using *PRINT.  Runs
  563.         on the Archimedes range only.
  564.  
  565. UdgConv Converts files of User Defined Graphics characters, for loading into
  566.         Page C, back into BASIC VDU statements.
  567.  
  568. DFSConv Converts an ADFS image of a DFS disc into the form required by
  569.         65Host for DFS emulation.
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.